import { createRouter, createWebHistory } from 'vue-router'
import { ElMessage } from 'element-plus'
import authRoutes from './routes/authRoutes'
import adminRoutes from './routes/adminRoutes'
import repairRoutes from './routes/repairRoutes'
import userRoutes from './routes/userRoutes'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/auth/login'
    },
    ...authRoutes,
    ...adminRoutes,
    ...repairRoutes,
    ...userRoutes
  ]
})

// 路由守卫
router.beforeEach((to, from, next) => {
  // TODO: 根据用户角色和登录状态进行路由控制
  next()
})

export default router
